// ----------------------------------
// RSDK Project: Sonic Essence
// Script Description: Egg Fighter Shooter
// Script Author: Tails LP
// ----------------------------------

//-------Aliases-------//

private alias object.value0 : frame.timer


private alias object.value40 : player.hitboxLeft
private alias object.value38 : player.hitboxTop
private alias object.value41 : player.hitboxRight
private alias object.value39 : player.hitboxBottom



//-------Tables-------//


//-------Functions-------//


event ObjectMain
	object.xpos += object.xvel

	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, -4, -4, 4, 4, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
		if checkResult == 1
			CallFunction(PlayerObject_ProjectileHit)
		endif
	next
	
	ObjectTileGrip(CSIDE_FLOOR, -20, -20, PATH_A)
	if checkResult == TRUE
		object.type = TypeName[Blank Object]
	endif

	ObjectTileGrip(CSIDE_LWALL, -16, -16, PATH_A)
	if checkResult == TRUE
		object.type = TypeName[Blank Object]
	endif

	ObjectTileGrip(CSIDE_RWALL, -16, -16, PATH_A)
	if checkResult == TRUE
		object.type = TypeName[Blank Object]
	endif


	ObjectTileGrip(CSIDE_ROOF, -20, -20, PATH_A)
	if checkResult == TRUE
		object.type = TypeName[Blank Object]
	endif
	
	if object.outOfBounds == true
		object.type = TypeName[Blank Object]
	end if
end event

event ObjectDraw	
	frame.timer ++
	if frame.timer > 5
		frame.timer = 0
		object.frame ^= 1
	endif
	DrawSpriteFX(object.frame, FX_ROTOZOOM, object.xpos, object.ypos)
end event

event ObjectStartup
    	LoadSpriteSheet("WIZ/Objects.gif")


	SpriteFrame(-4, -4, 8, 8, 104, 171)		// 0
	SpriteFrame(-4, -4, 8, 8, 113, 171)		// 1
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 223, 172)
end event